import React from 'react'
import { Navigate } from 'react-router-dom'

export default function Redirect(props) {
    let{ comp, path } = props
    //判断是否具有token，有token则视为已登录，无token则无登录
    let token = localStorage.getItem('token')

  return token ? comp : <Navigate to={`/login?path=${path}`}></Navigate>
}
